import {
	defineConfig
} from "vite";
import path from "path";
import uni from "@dcloudio/vite-plugin-uni";
import AutoImport from 'unplugin-auto-import/vite'
export default ({
	mode
}) => {
	return defineConfig({
		plugins: [
			uni({
				vueOptions: {
					template: {
						compilerOptions: {
							isCustomElement: (tag) => tag.startsWith("TRTCCloudUniPlugin-"),
						},
					},
				},
			}),
			AutoImport({
				imports: [{
					'@dcloudio/uni-app': ['onShow', 'onLoad', 'onHide','onUnload','onReachBottom'] // 按需添加其他生命周期
				}]
			})
		],
		css: {
			preprocessorOptions: {
				// 放在文件夹中需要预编译，放在根目录不需要配置
				scss: {
					additionalData: `@use "@/static/style/mixins.scss" as *;`,
				},
			},
		},
		resolve: {
			alias: {
				"@": path.resolve(__dirname, "src"),
			},
		},
	});
};